import VueRouter from 'vue-router'

//引入组件
import Index from '../pages'
import Home from '../pages/home/home'
import Login from '../pages/login/login'
import Register from '../pages/register/register'
import Center from '../pages/center/center'
import Forum from '../pages/forum/list'
import ForumAdd from '../pages/forum/add'
import ForumDetail from '../pages/forum/detail'
import MyForumList from '../pages/forum/myForumList'
import Storeup from '../pages/storeup/list'
import News from '../pages/news/news-list'
import NewsDetail from '../pages/news/news-detail'
import yonghuList from '../pages/yonghu/list'
import yonghuDetail from '../pages/yonghu/detail'
import yonghuAdd from '../pages/yonghu/add'
import meishicaipuList from '../pages/meishicaipu/list'
import meishicaipuDetail from '../pages/meishicaipu/detail'
import meishicaipuAdd from '../pages/meishicaipu/add'
import caipufenleiList from '../pages/caipufenlei/list'
import caipufenleiDetail from '../pages/caipufenlei/detail'
import caipufenleiAdd from '../pages/caipufenlei/add'
import meishixinxiList from '../pages/meishixinxi/list'
import meishixinxiDetail from '../pages/meishixinxi/detail'
import meishixinxiAdd from '../pages/meishixinxi/add'
import meishifenleiList from '../pages/meishifenlei/list'
import meishifenleiDetail from '../pages/meishifenlei/detail'
import meishifenleiAdd from '../pages/meishifenlei/add'

const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
	return originalPush.call(this, location).catch(err => err)
}

//配置路由
export default new VueRouter({
	routes:[
		{
      path: '/',
      redirect: '/index/home'
    },
		{
			path: '/index',
			component: Index,
			children:[
				{
					path: 'home',
					component: Home
				},
				{
					path: 'center',
					component: Center,
				},
				{
					path: 'forum',
					component: Forum
				},
				{
					path: 'forumAdd',
					component: ForumAdd
				},
				{
					path: 'forumDetail',
					component: ForumDetail
				},
				{
					path: 'myForumList',
					component: MyForumList
				},
				{
					path: 'storeup',
					component: Storeup
				},
				{
					path: 'news',
					component: News
				},
				{
					path: 'newsDetail',
					component: NewsDetail
				},
				{
					path: 'yonghu',
					component: yonghuList
				},
				{
					path: 'yonghuDetail',
					component: yonghuDetail
				},
				{
					path: 'yonghuAdd',
					component: yonghuAdd
				},
				{
					path: 'meishicaipu',
					component: meishicaipuList
				},
				{
					path: 'meishicaipuDetail',
					component: meishicaipuDetail
				},
				{
					path: 'meishicaipuAdd',
					component: meishicaipuAdd
				},
				{
					path: 'caipufenlei',
					component: caipufenleiList
				},
				{
					path: 'caipufenleiDetail',
					component: caipufenleiDetail
				},
				{
					path: 'caipufenleiAdd',
					component: caipufenleiAdd
				},
				{
					path: 'meishixinxi',
					component: meishixinxiList
				},
				{
					path: 'meishixinxiDetail',
					component: meishixinxiDetail
				},
				{
					path: 'meishixinxiAdd',
					component: meishixinxiAdd
				},
				{
					path: 'meishifenlei',
					component: meishifenleiList
				},
				{
					path: 'meishifenleiDetail',
					component: meishifenleiDetail
				},
				{
					path: 'meishifenleiAdd',
					component: meishifenleiAdd
				},
			]
		},
		{
			path: '/login',
			component: Login
		},
		{
			path: '/register',
			component: Register
		},
	]
})
